package com.ebelter.ty.ui.fragment.scale.register;

import android.content.Context;
import android.widget.RadioButton;
import android.widget.RadioGroup;


import com.ebelter.ty.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 性别页
 */

public class SexPager extends BasePager {

    RadioGroup rgSex;

    RadioButton rb_male_pager;

    RadioButton rb_female_pager;
    private int sex;

    public SexPager(Context context,int sex) {
        super(context);
        this.sex=sex;
        setSex(sex);
    }

    @Override
    protected int loadLayoutById() {
        return R.layout.pager_sex;
    }

    @Override
    public void initViews() {
        rgSex = mRootView.findViewById(R.id.rg_sex_pager);
        rb_male_pager = mRootView.findViewById(R.id.rb_male_pager);
        rb_female_pager=mRootView.findViewById(R.id.rb_female_pager);
        setSex(sex);
    }



    /**
     * 获取性别 1是男 2是女
     */
    public int getSexValue() {
        return rgSex.getCheckedRadioButtonId()==R.id.rb_male_pager?0:1;
    }

    public void setSex(int sex){
        this.sex=sex;
        if (rgSex!=null){
            rgSex.check(sex==0?rb_male_pager.getId():rb_female_pager.getId());
        }
    }

}
